#ifndef PILE_LIST_H
#define PILE_LIST_H

#include "Pile.h"

class Pile_List : public Pile {
public:

    // This shows up alot, define a type
    typedef std::list<Item*> Item_List;

    // Constructor and destructor:
    Pile_List();
    ~Pile_List();

    // Modifiers, which will be defined in this class:
    void add(Item *item);
    void partition(Categorizer& cat, std::vector<Pile*>& parts);
    void add(Pile *other);
    void clear();

    // Accessor, defined in this class
    Iterator<Item*> *new_iterator();
    int size();

private:
    // Peculiar to a list: lets you re-splice parts of a list.
    void move_block(Pile_List *source,
                    Pile_List *destination);

    // Peculiar to a list: lets you construct a subset using a range
    // within a list
    Pile_List(Pile_List& superset,
              Item_List::iterator first,
              Item_List::iterator last,
              int n);

    // the data in question (a list of labeled metric objs)
    Item_List *items;

    // used for iteration.
    Item_List::iterator first;
    // need ptr to last entry, 'cause the list.end() points beyond it.
    // otherwise splicing can't be done.
    Item_List::iterator last;

    int n;
};

#endif
